<!--<?php
include_once PrintEot('left');
if(empty($action)){
print <<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
        <li class="current"><a hidefocus="true" href="$basename">用户权限管理</a></li>
    </ul>
</div>
<h2 class="h1"><span class="mr20">系统组编辑</span></h2>
<form action="$basename&" method="post">
<input type="hidden" value="edit" name="action"/>
<div class="admin_table mb10">
	<table cellspacing="0" cellpadding="0" width="100%" >
   	<tbody>
   		<tr class="tr2">
        	<td style="width:40px;">&nbsp;</td>
            <td width="160">头衔</td>
            <td width="100">成员统计</td>
            <td>操作</td>
        </tr>
<!--
EOT;
foreach($rgroups as $group){
print <<<EOT
-->
		 <tr class="tr1">
        	<td class="td2">组ID{$group[gid]}</td>
        	<td class="td2"><input type="text" value="{$group[grouptitle]}" name="gtitle[{$group[gid]}]" class="input"/></td>
        	<td class="td2">$group[count]</td>
        	<td class="td2">
        		<a href="$basename&action=editgroup&gid=$group[gid]">[编辑]</a>
        		<a href="$basename&action=editmembers&gid=$group[gid]">[成员管理]</a>
        		<a href="$basename&action=del&gid=$group[gid]" onclick="return confirm('是否要删除该用户组？')">[删除]</a>
        	</td>
        </tr>
<!--
EOT;
}print <<<EOT
-->     
	</tbody>
	<tbody id="addtable">
		<tr style="display: none;" class="tr1 td_bgA" id="addline">
        	<td class="td2"></td>
            <td class="td2"><input type="text" value="" name="gtitle[]" class="input"/></td>
			<td class="td2" colspan="2">&nbsp;</td>
        </tr>
		<tr class="tr1 td_bgA">
			<td class="td2"><a href="javascript:;" onclick="addRecord('addline','addtable')"><i style="margin: 4px 2px 0pt 0pt;" class="expand expand_c" ></i>添加</a></td>
        	<td class="td2"><input type="text" value="" name="gtitle[]" class="input"/></td>
        	<td class="td2" colspan="2">&nbsp;</td>
        </tr>
    </tbody>  
    </table>
</div>
<div class="mb10 tac"><span class="btn"><span><button type="submit" onfocus="blur();">提 交</button></span></span></div>
</form>
<script type="text/javascript">
function addRecord(s,t) {
	var l = getObj(t).lastChild;
	var n = getObj(s).cloneNode(true);
	n.style.display = '';
	n.id = '';
	getObj(t).insertBefore(n,l);
}
</script>
<!--
EOT;
}elseif($action == 'editgroup'){
print <<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
        <li class="current"><a hidefocus="true" href="$basename">用户权限管理</a></li>
    </ul>
</div>

<form action="$basename&" method="post" name="mod">
<input type="hidden" name="action" value="editgroup"/>
<input type="hidden" name="step" value="2"/>
<h3 class="h1">用户组编辑</h3>
<div class="admin_table mb10">
	<table cellspacing="0" cellpadding="0" width="100%">
		<tbody>
			<tr class="tr1 vt">
				<td class="td1">用户组头衔</td>
				<td class="td2">
					<select onchange="redirect(this.value,'$basename')" class="select_wa" name="cgroup">
<!--
EOT;
foreach($rgroups as $group){
$selected = $group['gid'] == $gid ? 'selected' : '';
print <<<EOT
-->
						<option value="$group[gid]" $selected>$group[grouptitle]</option>
<!--
EOT;
}print <<<EOT
-->
					</select>
				</td>
				<td class="td2"></td>
			</tr>
		</tbody>
	</table>
</div>
<!--
EOT;
foreach($lang_right_house['right_title'] as $key => $value){
print <<<EOT
-->
<h3 class="h1">$value</h3>
<div class="admin_table mb10">
	<table cellspacing="0" cellpadding="0" width="100%">
		<tbody>
<!--
EOT;
foreach($lang_right_house['right'][$key] as $value){
eval("\$value[html] = \"".addcslashes($value['html'],'"')."\";");
print <<<EOT
-->
			<tr class="tr1 vt">
				<td class="td1">$value[title]</td>
				<td class="td2">$value[html]</td>
				<td class="td2"></td>
			</tr>
<!--
EOT;
}print <<<EOT
-->
		</tbody>
	</table>
</div>
<!--
EOT;
}print <<<EOT
-->
<div class="mb10 tac"><span class="btn"><span><button type="submit" onfocus="blur();">提 交</button></span></span></div>
</form>
<script language="JavaScript">
function redirect(value,adminfile) {
	location.href = adminfile + "&action=editgroup&gid=" + value;;
}
</script>
<!--
EOT;
}elseif($action == 'editmembers'){print <<<EOT
-->
<div class="nav3 mb10">
    <ul class="cc">
        <li class="current"><a hidefocus="true" href="$basenamebefor">用户权限管理</a></li>
    </ul>
</div>
<h2 class="h1"><span class="mr20">{$groupinfo[grouptitle]}成员管理</span></h2>
<div class="admin_table mb10">
	<table cellspacing="0" cellpadding="0" width="100%" >
   	<tbody>
   		<tr class="tr2">
            <td width="140">用户名</td>
            <td>操作</td>
        </tr>
<!--
EOT;
$memberarray = array();
foreach($members['contents'] as $key => $value){
$memberarray[] = $value[username];
print <<<EOT
-->
		<tr class="tr1">
            <td class="td1">$value[username]</td>
            <td class="td2"><a href="javascript:;" onclick="if(confirm('确认删除此用户？')){location.href='$basename&action=editmembers&uid=$value[uid]&step=3'}">[删除]</a></td>
        </tr>
<!--
EOT;
}print <<<EOT
-->
     </tbody>
    </table>
</div>
$members[pages]
<br><br><br>
<h2 class="h1"><span class="mr20">添加用户组成员</span></h2>
<form method="post" action="$basename" name="FORM">
<input type="hidden" value="editmembers" name="action"/>
<input type="hidden" value="2" name="step"/>
<input type="hidden" value="$gid" name="gid" />
<input type="hidden" value="$groupinfo[grouptitle]" name="grouptitle"/>
<div class="admin_table mb10">
	<table cellspacing="0" cellpadding="0" width="100%">
    	<tbody><tr class="tr1 vt">
        	<td class="td1">添加成员</td>
            <td class="td2"><input type="text" class="input input_wc" name="username" value="$username"/></td>
        </tr></tbody>
	</table>
</div>
<!--
EOT;
if($users && !empty($users['contents'])){
print <<<EOT
-->
<h2 class="h1"><span class="mr20">用户列表</span></h2>
<div class="admin_table mb10">
	<table cellspacing="0" cellpadding="0" width="100%">
    	<tbody>
	    	<tr class="tr2">
	        	<td width="24" class="tac"><a onclick="CheckAll(document.FORM)" href="javascript:;">全选</a></td>
	            <td>用户名</td>
	            <td></td>
	        </tr>
<!--
EOT;
foreach($users['contents'] as $key => $value){
if(is_array($memberarray) && !in_array($value[username],$memberarray)){
print <<<EOT
-->
	        <tr class="tr1 vt">
	        	<td class="td2"><input type="checkbox" value="$value[username]" name="uids[$value[uid]]"/></td>
	            <td class="td2">$value[username]</td>
				<td class="td2"></td>
        	</tr>
<!--
EOT;
}}print <<<EOT
-->
        </tbody>
	</table>
</div>
<!--
EOT;
}print <<<EOT
-->
<div class="mb10 tac">
<!--
EOT;
if($users && !empty($users['contents'])){
print <<<EOT
-->
<span class="bt"><span><button onfocus="blur();" onclick="CheckAll(this.form)" type="button">全 选</button></span></span>
<!--
EOT;
}print <<<EOT
-->
<span class="btn"><span><button type="submit" onfocus="blur();">提 交</button></span></span></div>
</form>
<!--
EOT;
}include_once PrintEot('adminbottom');
?>-->